package com.yjd.bi.first.dao.impl;

import org.springframework.stereotype.Component;
import com.yjd.comm.base.dao.impl.BaseDaoImpl;
import com.yjd.bi.first.model.InvestFirstModel;
import com.yjd.bi.first.dao.IInvestFirstDao;

import java.util.List;
import java.util.Map;

/**
 * <b>description</b>：首次投资记录（投标和债权转让）数据访问层 <br>
 * <b>time</b>：2017-04-01 16:50:24 <br>
 * <b>author</b>： carl
 */
@Component("investFirstDao")
public class InvestFirstDaoImpl extends BaseDaoImpl implements IInvestFirstDao {

    private static final String SQLMAPNAMESPACE = InvestFirstModel.class.getName();
    private static final String PKNAME = "user_id";

    @Override
    public String getPrimaryKeyName() {
        return PKNAME;
    }

    @Override
    public String getSqlmapNamespace() {
        return SQLMAPNAMESPACE;
    }

    @Override
    public List<InvestFirstModel> getInvestFirstList(Map param) throws Exception {
        return (List<InvestFirstModel>) this.getSqlMap(false).queryForList(this.getStatement("getInvestFirstList"), param);
    }

    @Override
    public List<InvestFirstModel> getCreditorTransferFirstList(Map param) throws Exception {
        return (List<InvestFirstModel>) this.getSqlMap(false).queryForList(this.getStatement("getCreditorTransferFirstList"), param);
    }

    @Override
    public Double getFirstInvestUseTimes(Map param) throws Exception {
        Object myObject = this.getSqlMap(false).queryForObject(this.getStatement("getFirstInvestUseTimes"), param);
        if (myObject != null) {
            return Double.parseDouble(myObject.toString());
        }
        return 0.00D;
    }

    @Override
    public List<InvestFirstModel> getWalFirstList(Map param) throws Exception {
        return (List<InvestFirstModel>) this.getSqlMap(false).queryForList(this.getStatement("getWalFirstList"), param);
    }
}
